package br.com.basili.converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

import br.com.basili.entity.Affiliation;

@FacesConverter("filConv")
public class AffiliationConverter implements Converter {

	@Override
	public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
		Affiliation c = new Affiliation();
		if( !arg2.equals("") || arg2 != null )
			c = new Affiliation(arg2);
		return c;
	}

	@Override
	public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
		String s = "";
		if( arg2 == null || arg2.equals(""))
			return s;
		return ((Affiliation)arg2).getDesc();
	}

}
